<%@page contentType="text/html; charset=utf-8"%>
<%@ include file="../inc/TagLibs.jsp"%>
<c:set var="pageTitle" value="地区" />
<%@ include file="../inc/Title.jsp"%>
<head>
<link rel="stylesheet" type="text/css" href="/css/base.css" />
<script src="/js/popup_ext.js"></script>
<script language="javascript">
	function doNew(){
		var url="/base/AreaNew.ihtm?parent_id=${parentId}";
		ShowIframeNoScroll("地区",url,320,275,"refreshWin()");
	}
	function refreshWin(){
		window.location.reload(true);
	}
	function doEdit(id){
		var url="/base/AreaEdit.ihtm?id="+id;
		ShowIframeNoScroll("地区",url,320,275,"refreshWin()");
	}
	function doDelete(id){
		ShowConfirm('确认框','确定删除吗？',340,80,"doDelAct("+id+")");
	}
	function doDelAct(id){
		if(popRetVal!=null){
			window.location="/base/AreaDelete.ihtm?id="+id+"&from_url="+encodeURIComponent(window.location);
		}
	}
	function doSearch(){
		var parentId=document.getElementById("parent_id").value;
		window.location="/base/AreaList.ihtm?parent_id="+parentId;
	}
	function doCancel(){
		window.close();
	}
	function doBack(){
		window.location="/base/AreaList.ihtm?parent_id=${retId}";
	}
	function goChildren(parentId){
		window.location="/base/AreaList.ihtm?parent_id="+parentId;
	}
</script>
</head>
<body oncontextmenu="return false" class="sheet" style="text-align:center;">
<div class="sheet-main" style="width:500px;text-align:left;margin:auto;">
  <div class="sheet-top">
    <div class="content">
      <h2>地区</h2>
      <p>应用于客户档案、供应商档案、外协商档案，方便分类查询与统计</p>
    </div>
  </div>
  <div class="sheet-list">
    <div class="search-business">
	    <div class="add_content"> 	
	    	 <div align="right">
			 <select name='parent_id' id="parent_id" style="width:140px">
				<option value="0" <c:if test="${parentId=='0'}">selected</c:if>>（无）</option>
				<commonTag:createSelectTree list="${areaList}" emptyOption="0" defaultValue="${parentId}" />
			 </select>
			 <input type="button"  value=" 查 询" onClick="doSearch();"  class="buttom search-but">
			 <input type="button" class="buttom search-add" value=" 新 增" onClick="doNew();">
			 <input type="button" class="buttom search-back" value=" 回上级" onClick="doBack();" <c:if test="${parentId=='0'}">disabled="true"</c:if>>
			 </div>
	     </div>
		 <%@include file="../inc/AlertMsg.jsp"%>
	     <div class="table-list">
	        <table width="100%">
	          <tr>
					<th width="80">序号</th>
					<th width="200">名称</th>
					<th>操作</th>
				</tr>
				<c:forEach var="item" items="${list}">
				<tr>
					<td >${item.sequCode}</td>
					<td >${item.areaName}</td>
					<td >
						<a href="javascript:goChildren('${item.id}');">进入子分类</a>
						<a href="javascript:doEdit('${item.id}');">编辑</a>
						<a href="javascript:doDelete('${item.id}');">删除</a>
					</td>
				</tr>
				</c:forEach>
			</table>
		  </div>  
	   </div>  
  </div>
  <div class="blank12"></blank>
</div>
</body>
</html>